window.onload=function(){
    //获取标签
    const tab_header = document.querySelector('.tab_header');
    const allLis = tab_header.getElementsByTagName('li');
    const tab_content = document.querySelector('.tab_content');
    const allDoms = tab_content.getElementsByClassName('dom');

    for(let i=0; i<allLis.length; i++){
        const li = allLis[i];
        li.index=i;

        li.onclick=function(){
            //1、清除同级别的选中样式类
            for(let j=0; j<allLis.length; j++){
                allLis[j].className="";
                allDoms[j].style.display='none';
            }
            //2、设置当前的li标签选中样式类
            this.className="selected";
            allDoms[this.index].style.display='block';
        }
    }
};
